import buildTsVoCode from "./builder/TsVoCodeBuilder"

let dir = ""
let codeOut = ""
let dataOut = ""
let type: any
let flag = ""

process.argv.forEach(opt => {
    switch (flag) {
        case "i":
            flag = ""
            dir = opt
            return
        case "co":
            flag = ""
            codeOut = opt
            return
        case "do":
            flag = ""
            dataOut = opt
            return
        case "t":
            flag = ""
            type = opt
            return
    }
    if (opt.includes("-i")) {
        flag = "i"
    } else if (opt.includes("-co")) {
        flag = "co"
    } else if (opt.includes("-do")) {
        flag = "do"
    } else if (opt.includes("-t")) {
        flag = "t"
    }
})

if (dir && (codeOut || dataOut) && type) {
    buildTsVoCode(dir, codeOut, dataOut, type)
} else {
    console.log("请输入RO目录、代码和data导出目录、导出类型");
}